/*
 * @Description:
 * @Version: 2.0
 * @Autor: Seven
 * @Date: 2023-10-19 15:02:49
 * @LastEditors: Seven
 * @LastEditTime: 2023-11-09 09:36:41
 */
import hyRequest from "../request";
// 查询字典
export function getDicData(type) {
  return hyRequest.get({
    url: `/dict/${type}`,
  });
}
export function getDicDataList(type) {
  return hyRequest.get({
    url: `/dict/list`,
  });
}

//年计划list
export function getYearList(
  dept = "",
  planDesc = "",
  planId = "",
  status = "",
  workshop = "",
  pageNum,
  pageSize
) {
  return hyRequest.get({
    url: `/year/list?dept=${dept}&planDesc=${planDesc}&planId=${planId}&status=${status}&workshop=${workshop}&pageSize=${pageSize}&pageNum=${pageNum}`,
  });
}
//年计划添加
export function getYearAdd(data) {
  return hyRequest.post({
    url: "/year/add",
    data,
  });
}
//年计划删除
export function getYearDelete(yearids) {
  return hyRequest.delete({
    url: `/year/remove/${yearids}`,
  });
}
//年计划详情
export function getYearDetail(id) {
  return hyRequest.get({
    url: `/year/${id}`,
  });
}
//年计划修改
export function getYearEdit(id, data) {
  return hyRequest.post({
    url: `/year/edit/${id}`,
    data,
  });
}
export function getYearDeal(id) {
  return hyRequest.get({
    url: `/year/process/${id}`,
  });
}
//月计划list
export function getMonthList(
  dept = "",
  planDesc = "",
  planId = "",
  status = "",
  workshop = "",
  pageNum,
  pageSize
) {
  return hyRequest.get({
    url: `/month/list?dept=${dept}&planDesc=${planDesc}&planId=${planId}&status=${status}&workshop=${workshop}&pageSize=${pageSize}&pageNum=${pageNum}`,
  });
}
//添加
export function getMonthAdd(data) {
  return hyRequest.post({
    url: "/month/add",
    data,
  });
}
//删除
export function getMonthDelete(yearids) {
  return hyRequest.delete({
    url: `/month/remove/${yearids}`,
  });
}
//详情
export function getMonthDetail(id) {
  return hyRequest.get({
    url: `/month/${id}`,
  });
}
//修改
export function getMonthEdit(id, data) {
  return hyRequest.post({
    url: `/month/edit/${id}`,
    data,
  });
}

//周计划list
export function getWeekList(
  dept = "",
  planDesc = "",
  planId = "",
  status = "",
  workshop = "",
  pageNum,
  pageSize
) {
  return hyRequest.get({
    url: `/week/list?dept=${dept}&planDesc=${planDesc}&planId=${planId}&status=${status}&workshop=${workshop}&pageNum=${pageNum}&pageSize=${pageSize}`,
  });
}
//添加
export function getWeekAdd(data) {
  return hyRequest.post({
    url: "/week/add",
    data,
  });
}
//删除
export function getWeekDelete(yearids) {
  return hyRequest.delete({
    url: `/week/remove/${yearids}`,
  });
}
//详情
export function getWeekDetail(id) {
  return hyRequest.get({
    url: `/week/${id}`,
  });
}
//修改
export function getWeekEdit(id, data) {
  return hyRequest.post({
    url: `/week/edit/${id}`,
    data,
  });
}

//检修工单
// list
export function getMaintenanceList(
  maintenanceId = "",
  maintenanceDesc = "",
  speciality = "",
  status = "",
  line = null,
  pageNum,
  pageSize
) {
  return hyRequest.get({
    url: `/maintenance/list?maintenanceId=${maintenanceId}&pageNum=${pageNum}&pageSize=${pageSize}&maintenanceDesc=${maintenanceDesc}&speciality=${speciality}&status=${status}${
      line ? `&line=${line}` : ""
    }`,
  });
}
//添加
export function getMaintenanceAdd(data) {
  return hyRequest.post({
    url: "/maintenance/add",
    data,
  });
}
//删除
export function getMaintenanceDelete(id) {
  return hyRequest.delete({
    url: `/maintenance/remove/${id}`,
  });
}
//修改
export function getMaintenanceEdit(id, data) {
  return hyRequest.post({
    url: `/maintenance/edit/${id}`,
    data,
  });
}
//开始检修
export function getStartmaintenance(id) {
  return hyRequest.post({
    url: `/maintenance/startmaintenance/${id}`,
  });
}
//结束检修
export function getEndmaintenance(id) {
  return hyRequest.post({
    url: `/maintenance/endmaintenance/${id}`,
  });
}
//完成工单
export function getCompleted(id) {
  return hyRequest.post({
    url: `/maintenance/completed/${id}`,
  });
}

//故障工单
export function getTroubleList(
  troubleId = "",
  troubleDesc = "",
  speciality = "",
  line = null,
  status = "",
  pageNum,
  pageSize
) {
  return hyRequest.get({
    url: `/trouble/list?troubleId=${troubleId}&troubleDesc=${troubleDesc}&speciality=${speciality}&pageNum=${pageNum}&pageSize=${pageSize}&status=${status}${
      line ? `&line=${line}` : ""
    }`,
  });
}

//开始检修
export function getTroubleStart(id) {
  return hyRequest.post({
    url: `/trouble//startmaintenance/${id}`,
  });
}
//结束检修
export function getTroubleEnd(id) {
  return hyRequest.post({
    url: `/trouble//endmaintenance/${id}`,
  });
}
//添加
export function getTroubleAdd(data) {
  return hyRequest.post({
    url: "/trouble/add",
    data,
  });
}
//删除
export function getTroubleDelete(id) {
  return hyRequest.delete({
    url: `/trouble/remove/${id}`,
  });
}
//修改
export function getTroubleEdit(id, data) {
  return hyRequest.post({
    url: `/trouble/edit/${id}`,
    data,
  });
}

//完成工单
export function getTroubleCompleted(id) {
  return hyRequest.post({
    url: `/trouble/completed/${id}`,
  });
}

//故障提报
export function getOrderList(
  faultId = "",
  level = "",
  speciality = "",
  description = "",
  status = "",
  line = null,
  pageNum,
  pageSize
) {
  return hyRequest.get({
    url: `/project/order/list?faultId=${faultId}&description=${description}&level=${level}&speciality=${speciality}&pageNum=${pageNum}&pageSize=${pageSize}&status=${status}${
      line ? `&line=${line}` : ""
    }`,
  });
}
//添加
export function getOrderAdd(data) {
  return hyRequest.post({
    url: "/project/order/add",
    data,
  });
}
//删除
export function getOrderDelete(ids) {
  return hyRequest.delete({
    url: `/project/order/delete/${ids}`,
  });
}
//详情
export function getOrderDetails(id) {
  return hyRequest.get({
    url: `/project/order/details/${id}`,
  });
}
//导出Excel
export function getOrderExport() {
  return hyRequest.post({
    url: `/project/order/export`,
  });
}
//生成故障工单
export function getOrderGenner(data, id) {
  console.log(data, id);
  return hyRequest.post({
    url: `/project/order/generate/${id}`,
    data,
  });
}
//手动处理
export function getOrderHandle(id) {
  return hyRequest.post({
    url: `/project/order/handle/${id}`,
  });
}
//修改故障提报
export function getOrderUpdate(id, data) {
  return hyRequest.post({
    url: `/project/order/update/${id}`,
    data,
  });
}

//设备台账
export function getEquipmentList(
  registrationId = "",
  registrationName = "",
  registrationType = "",
  line = "",
  speciality = "",
  dept = "",
  pageNum,
  pageSize
) {
  return hyRequest.get({
    url: `/equipment/list?registrationId=${registrationId}&registrationName=${registrationName}&registrationType=${registrationType}&line=${line}&speciality=${speciality}&dept=${dept}&pageSize=${pageSize}&pageNum=${pageNum}`,
  });
}
//添加
export function getEquipmentAdd(data) {
  return hyRequest.post({
    url: "/equipment/add",
    data,
  });
}
//删除
export function getEquipmentDelete(ids) {
  return hyRequest.delete({
    url: `/equipment/remove/${ids}`,
  });
}
//详情
export function getEquipmentDetail(id) {
  return hyRequest.get({
    url: `/equipment/${id}`,
  });
}
//修改
export function getEquipmentEdit(id, data) {
  return hyRequest.post({
    url: `/equipment/update/${id}`,
    data,
  });
}
//设备登记
export function getDeviceList(
  registrationId = "",
  registrationDesc = "",
  applicationDept = "",
  line = "",
  speciality = "",
  pageNum,
  pageSize
) {
  return hyRequest.get({
    url: `/device/list?registrationId=${registrationId}&registrationDesc=${registrationDesc}&applicationDept=${applicationDept}&line=${line}&speciality=${speciality}&pageSize=${pageSize}&pageNum=${pageNum}`,
  });
}
//添加
export function getDeviceAdd(data) {
  return hyRequest.post({
    url: "/device/add",
    data,
  });
}
//删除
export function getDeviceDelete(ids) {
  return hyRequest.delete({
    url: `/device/remove/${ids}`,
  });
}
//详情
export function getDeviceDetail(id) {
  return hyRequest.get({
    url: `/device/${id}`,
  });
}
//修改
export function getDeviceEdit(id, data) {
  return hyRequest.post({
    url: `/device/update/${id}`,
    data,
  });
}
//专家知识库
// 新增
export function getKnowledgeAdd(formData) {
  return hyRequest.post({
    url: `/knowledge/add`,
    headers: {
      "Content-Type": "multipart/form-data",
    },
    data: formData,
  });
}
//列表
export function getKnowledgeList(
  speciality = "",
  device = "",
  description = "",
  line = "",
  pageNum,
  pageSize
) {
  return hyRequest.get({
    url: `/knowledge/list?speciality=${speciality}&device=${device}&description=${description}&line=${line}&pageSize=${pageSize}&pageNum=${pageNum}`,
  });
}
//修改
export function getKnowledgeEdit(id, data) {
  return hyRequest.post({
    url: `/knowledge/edit/${id}`,
    data,
  });
}
//删除
export function getKnowledgeDelete(id) {
  return hyRequest.delete({
    url: `/knowledge/remove/${id}`,
  });
}
//详情
export function getKnowledgeDetail(id) {
  return hyRequest.get({
    url: `/knowledge/${id}`,
  });
}
//上传
export function getKnowledgeUpload(id, formData) {
  return hyRequest.post({
    url: `/knowledge/upload/img/${id}`,
    data: formData,
  });
}
